/*
******************
* author: 马丰彦
* date: 2019
* function: 连接数据库
******************
*/

var mongoose = require('mongoose');
mongoose.connect('mongodb://127.0.0.1"27017/film', {
  useNewUrlParser: true
})
const db = mongoose.connection
db.once('open', function () {
  console.log('连接数据库成功');
})
db.on('error', function (error) {
  console.log('连接失败' + error);
});
db.on('disconnected', function () {
  console.log('连接断开');
})